procedure to draw the hasse diagram